package com.dingding.dao.userorderdao.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.dingding.bean.entity.Userorder;
import com.dingding.dao.basedao.impl.BaseDaoImpl;
import com.dingding.dao.sql.UserOrderDaoSql;
import com.dingding.dao.userorderdao.IUserOrderDao;

public class UserOrderDaoImpl extends BaseDaoImpl<Userorder> implements IUserOrderDao {

	/**
	 * 
	 * 乘客评价完车主后，需要对车主重新计算一个平均信誉值。 需要用到车主ID,当前接口由此产生
	 * 
	 * @Title: getDriverId
	 * @param orderId
	 * @return String 车主ID
	 * @author CHEHAUNBO
	 * 
	 */
	@Override
	@Transactional(readOnly = true)
	public String getDriverId(String orderId) {

		List<Object[]> objects = null;
		try {
			objects = super.sqlQueryListObj(UserOrderDaoSql.GET_DRIVERID, false, orderId);
		} catch (Exception e) {
			log.error("乘客评价完成后，更新车主信誉值时获取车主ID出现异常！", e);
		}
		if (objects != null && objects.size() > 0) {
			Object obj = objects.get(0);
			return obj.toString();
		}
		return null;
	}

}
